<!DOCTYPE html>
<html>
<head>
    <title>Text Node Example</title>
</head>
<body>
    <div id="myDiv">Hello world!</div>

    <input type="button" value="Change Text" onclick="changeText()">

    <script type="text/javascript">
        function changeText(){
            var div = document.getElementById("myDiv");
            div.firstChild.nodeValue = "Some other message";
        }

    </script>
</body>
</html>